﻿@inject IHttpService _httpService


@if (isReady)
{
    <CnGalWebSite.Components.Containers.MasaTitleContainer Title="新手任务" Icon="@IconType.NewbieTask.ToIconString()" Collapable Outline>
     <MRow>
         <MCol Cols="12" Md="6" Lg="4" Xl="3" Class="mb-4">
             <BindSteamIdCard Model="Model" />
         </MCol>
     </MRow>
 </CnGalWebSite.Components.Containers.MasaTitleContainer>
    <CnGalWebSite.Components.Containers.MasaTitleContainer Title="日常任务" Icon="@IconType.DailyTask.ToIconString()" Collapable Outline>
     <MRow>
         <MCol Cols="12" Md="6" Lg="4" Xl="3" Class="mb-4">
             <SignInCard Model="Model" />
         </MCol>
     </MRow>
 </CnGalWebSite.Components.Containers.MasaTitleContainer>
}
else
{
    <CnGalWebSite.Components.Progressings.ProgressingCard Page Fill />
}

@code {
    bool isReady;

    public UserTaskModel Model { get; set; }

    [CascadingParameter]
    public ErrorHandler ErrorHandler { get; set; }


    protected override async Task OnInitializedAsync()
    {
        try
        {
            Model = await _httpService.GetAsync<UserTaskModel>("api/space/GetUserTasks");
            isReady = true;
        }
        catch (Exception ex)
        {
            await ErrorHandler.ProcessError(ex, "获取用户任务列表失败");
        }
    }
}
